Skip to main content

Input

Description

<jp-input> is a field component with <input> functionality.


Attributes

NameRequiredTypeDescription
labelstringshows at the top of an input
labelType'outside' or 'inside'whether label is inside or outside of the field
placeholderstringtemporary text that appears in an
input field before any input is entered
valuestringsetter
namestringname of the form control
hintstringhelps users establish what information they should enter into the field
autocompletestringpredicts the value of an input field
idstringunique identifier
autocompletestringsetter
inputFocusedbooleandetermines if an input is focused on page load
disabledbooleandetermines if an input is disabled
liststringid of datalist (list of predefined values)
minnumberminimal value on numeric input
maxnumbermaximal value on numeric input
stepnumber or 'any'number that specifies step on numeric input
requiredbooleandetermines if an input is required
requiredValidationMessagestringvalidation message for when component does not satisfy required
readonlybooleandetermines if an input is read-only
typeOne of the following:
'text', 'password',
'email', 'tel', 'url'
type of input
minlengthnumberminimum character count allowed
minlengthValidationMessagestringvalidation message for when component does not satisfy minlength
maxlengthnumbermaximum character count allowed
maxlengthValidationMessagestringvalidation message for when component does not satisfy maxlength
patternstringpattern that input has to satisfy
patternValidationMessagestringvalidation message for when component does not satisfy pattern
validationMessages{[type]: string} where type is stringcompact way of writing validation messages in a single attribute
hideArrowsOnNumberbooleandetermines if arrows on number type input are shown
allowNumberInputShorcutbooleandetermines if keyboard shortcut for adjusting a numeric input is enabled
shiftStepnumberdetermines step value of keyboard shortcut


Slots

  • hint
    • renders below the input field
  • prefix
    • renders in front of the input field
  • suffix
    • renders after the input field


Methods

  • getValue
    • returns form field value
  • reportValidity
    • triggers reportValidity


Events

  • value
    • triggers when value of the field changes


Demo

Live Editor
// import '@jaspero/web-components/input.wc.js';
// import '@jaspero/web-components/input.css';

<jp-input label="Input"></jp-input>
Result
Loading...